<template>
  <div class="order-detail-page" v-if="order">
    <!-- 操作栏 -->
    <DetailAction :order="order" />
    <!-- 步骤条 组件xtx-steps.vue-->
    <detail-steps :order="order"></detail-steps>
    <!-- 物流栏 -->
    <detail-logistics
      :order="order"
      v-if="[3, 4, 5].includes(order.orderState)"
    ></detail-logistics>
    <!-- 订单商品信息 -->
    <detail-info :order="order"></detail-info>
  </div>
</template>
<script>
import DetailAction from "./components/DetailAction";
import { ref } from "vue";
import { findOrder } from "api/order";
import { useRoute } from "vue-router";
import DetailSteps from "./components/DetailSteps.vue";
import DetailLogistics from "./components/DetailLogistics.vue";
import DetailInfo from './components/DetailInfo.vue';

export default {
  name: "OrderDetail",
  components: { DetailAction, DetailSteps, DetailLogistics, DetailInfo },
  setup() {
    const order = ref(null);
    const route = useRoute();
    findOrder(route.params.id).then((data) => {
      order.value = data.result;
    });
    return { order };
  },
};
</script>
<style scoped lang="less">
.order-detail-page {
  background: #fff;
}
</style>